package com.kehutong.flow.entity;

import org.coraframework.json.annotation.JSONField;
import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;
import org.coraframework.orm.annotation.Table;
import org.coraframework.orm.annotation.UnSave;

import java.sql.Timestamp;
import java.util.Collections;
import java.util.List;

/**
 * 流程规则
 *
 */
@Table(value="t_flow_rule", comment="流程规则", multi=true)
public class FlowRule extends Entity {

    private static final long serialVersionUID = -7427437499076204352L;

    protected FlowRule(String id) {
        super(id);
    }

    @Column(comment="流程名称")
    private String name;
    
    @Column(comment="流程类型[1:督导流程; 2:敏感词提醒]")
    private int type;

    @Column(dbType = "TEXT", comment="关键词编号")
    private List<String> keyids;
    
    @Column(dbType = "TEXT", comment="关键词")
    private List<String> keyWords;
    
    @Column(dbType = "TEXT", comment="节点")
    private List<String> nodeList;

    @JSONField(serialize=false)
    @Column(comment="逻辑删除")
    private boolean deleted;

    @Column(comment = "最后修改人id")
	private String updateById;

	@Column(comment = "最后修改人name")
	private String updateByName;

    @UnSave
    private List<FlowRuleNode> nodes;

	@UnSave
	private Timestamp updateByTime;

	public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
	public List<String> getKeyids() {
		return keyids;
	}

	public void setKeyids(List<String> keyids) {
		this.keyids = keyids;
	}

	public List<String> getKeyWords() {
		return keyWords;
	}

	public void setKeyWords(List<String> keyWords) {
		this.keyWords = keyWords;
	}

	public List<String> getNodeList() {
		if (nodeList == null) {
			return Collections.emptyList();
		}
		return nodeList;
	}

	public void setNodeList(List<String> nodeList) {
		this.nodeList = nodeList;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public String getUpdateById() {
		return updateById;
	}

	public void setUpdateById(String updateById) {
		this.updateById = updateById;
	}

	public String getUpdateByName() {
		return updateByName;
	}

	public void setUpdateByName(String updateByName) {
		this.updateByName = updateByName;
	}

	public List<FlowRuleNode> getNodes() {
		return nodes;
	}

	public void setNodes(List<FlowRuleNode> nodes) {
		this.nodes = nodes;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public Timestamp getUpdateByTime() {
		return updateByTime;
	}

	public void setUpdateByTime(Timestamp updateByTime) {
		this.updateByTime = updateByTime;
	}
}
